import os

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class NotFound(webapp.RequestHandler):
  def get(self):
    self.response.set_status(404)
    self.response.out.write("""<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
	<title>404 Not Found</title>
</head><body>
	<h1>Not Found</h1>
	<p>The requested URL %s was not found on this server.</p>
	<hr />
	<address>%s at %s Port %s</address>
</body></html>
""" % (os.environ['PATH_INFO'], os.environ['SERVER_SOFTWARE'], os.environ['SERVER_NAME'], os.environ['SERVER_PORT']))

application = webapp.WSGIApplication(
                                     [('.*', NotFound)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()
